package cn.iocoder.yudao.module.dbit.service.jobinfo;

import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.dbit.dal.dataobject.jobinfo.JobCollectionInfoDO;
import cn.iocoder.yudao.module.dbit.dal.mysql.jobinfo.JobCollectionInfoMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @Author : 硕哥
 * @Description : 硕哥无敌 寿与天齐
 * @Date : 2024年12月02日 2:05 PM
 */
@Service
public class JobCollectionServiceImpl implements JobCollectionService {
    @Resource
    private JobCollectionInfoMapper jobCollectionInfoMapper;

    @Override
    public Integer createCollectionInfo(Integer jobId) {
        //获取当前登录人id
        Long userId = SecurityFrameworkUtils.getLoginUserId();
        Integer uid = userId != null ? userId.intValue() : 0;
        JobCollectionInfoDO jobCollectionInfoDO = new JobCollectionInfoDO();
        jobCollectionInfoDO.setJobId(jobId);
        jobCollectionInfoDO.setUserId(uid);
        return jobCollectionInfoMapper.insert(jobCollectionInfoDO);
    }
}
